package com.leifeng.security.web.async;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import lombok.Data;

@Data
@Component
public class MockQueue {
	
	private Logger logger=LoggerFactory.getLogger(getClass());
	
	private String placeOrder;
	
	private String completeOrder;
	
	public void setPlaceOrder(String placeOrder) throws Exception{
		
		new Thread(() ->{
			
			System.out.println("接到下单请求,"+placeOrder);
			logger.info("接到下单请求,"+placeOrder);
			try {
				Thread.sleep(10000);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			this.placeOrder=placeOrder;
			
			logger.info("下单请求处理完毕,"+placeOrder);
		}).start();;
		
		
	}

}
